notebook: Warn if builder file defines multiple tab widgets per page
authorBenjamin Otte <otte@redhat.com>
Wed, 27 Apr 2011 22:51:37 +0000 (00:51 +0200)
committerBenjamin Otte <otte@redhat.com>
Wed, 27 Apr 2011 22:54:34 +0000 (00:54 +0200)
Glade causes such files when a notebook page has no content. And it's
especially bad because the last tab widget wins, so the label displayed
in Glade will not be what you see when you run the app.

gtk/gtknotebook.c

index f8f3d1303d43e1c3ff506db9055791ad82f052ac..6ab853ac48f2485cc3f3153d44b896558e941aeb 100644 (file)
@@ -1228,6 +1228,9 @@ gtk_notebook_buildable_add_child (GtkBuildable  *buildable,
       /* To set the tab label widget, we must have already a child
        * inside the tab container. */
       g_assert (page != NULL);
+      /* warn when Glade tries to overwrite label */
+      if (gtk_notebook_get_tab_label (notebook, page))
+        g_warning ("Overriding tab label for notebook");
       gtk_notebook_set_tab_label (notebook, page, GTK_WIDGET (child));
     }
   else if (type && strcmp (type, "action-start") == 0)